<link type="text/css" href="assets/css/smoothness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<style type= "text/css">
a:link, a:visited, a:hover {
	font-size:12px;
	color:#CD240D
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
	</script>
<div id="tabs">
  <ul>
    <li><a href="#tabs-1">类别</a></li>
    <li><a href="#tabs-2">书</a></li>
    <li><a href="#tabs-3">添加类别</a></li>
    <li><a href="#tabs-4">添加书</a></li>
  </ul>
  <div id="tabs-1">
    <table class="testgrid" id="tableid">
      <thead>
        <tr>
          <th>id</th>
          <th>类别名</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <?php
	foreach($category_list as $category)
	{
?>
        <tr id="DemoGrid">
          <td><?php echo $category->id; ?></td>
          <td><?php echo $category->name; ?></td>
          <td><a href="/admin/category/delete/<?php echo $category->id; ?>" onClick="var bl=confirm('真要删除?'); if(bl){return true;} else {return false;}" class="rates_button">删除</a> <a href="/admin/category/modify/<?php echo $category->id; ?>" class="rates_button">编辑</a> </td>
        </tr>
        <?php
	}
?>
      </tbody>
    </table>
  </div>
  <div id="tabs-2">
    <table class="testgrid" id="tableid">
      <thead>
        <tr>
          <th>id</th>
          <th>类别id</th>
          <th>书名</th>
          <th>描述</th>
          <th>下载量</th>
          <th>状态</th>
          <th>创建时间</th>
          <th>更新时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <?php
	foreach($booklet_list as $booklet)
	{
?>
        <tr id="DemoGrid">
          <td><?php echo $booklet->id; ?></td>
          <td><?php echo $booklet->category_id; ?></td>
          <td><?php echo $booklet->name; ?></td>
          <td><?php echo $booklet->description; ?></td>
          <td><?php echo $booklet->download_count; ?></td>
          <td><?php echo $booklet->status; ?></td>
          <td><?php echo $booklet->create_time; ?></td>
          <td><?php echo $booklet->update_time; ?></td>
          <td><a href="/admin/booklet/delete/<?php echo $booklet->id; ?>" onClick="var bl=confirm('真要删除?'); if(bl){return true;} else {return false;}" class="rates_button">删除</a> <a href="/admin/booklet/modify/<?php echo $booklet->id; ?>" class="rates_button">编辑</a> <a href="/admin/picture/add/<?php echo $booklet->id; ?>" class="rates_button">添加图片</a> </td>
        </tr>
        <?php
	}
?>
      </tbody>
    </table>
  </div>
  <div id="tabs-3">
    <form id="inputForm" action="/admin/category/save" method="post" enctype="multipart/form-data">
      <div class="row clearfix">
        <label for="name">类别名:</label>
        <p><span>
          <input name="name" maxlength="100" id="name" class="inputs med required">
          </span><span id="NameError"></span></p>
      </div>
      <div class="row clearfix">
        <label for="name">类别图:</label>
        <input name="imgfile" type="file" accept="image/*">
      </div>
      <div class="row clearfix">
        <input type="submit" name="submitBtn" id="submitBtn" class="submit" value="添加">
      </div>
    </form>
  </div>
  <div id="tabs-4">
    <form id="inputForm" action="/admin/booklet/save" method="post">
      <div class="row clearfix">
        <label for="name">书名:</label>
        <p><span>
          <input name="name" maxlength="100" id="name" class="inputs med required">
          </span><span id="NameError"></span></p>
      </div>
      <div class="row clearfix">
        <label for="desc">描述:</label>
        <p><span>
          <textarea id="descriptions" name="descriptions" class="inputs med long required" rows="10"></textarea>
          </span></p>
      </div>
      <div class="row clearfix">
        <label for="desc">类别:</label>
        <select>
          <?php
	foreach($category_list as $category)
	{
?>
          <option value ='<?php echo $category->id; ?>'><?php echo $category->name; ?></option>
          <?php
	}
?>
        </select>
      </div>
      <div class="row clearfix">
        <label for="preview">缩略图 :</label>
        <input name="imgfile" type="file" accept="image/*">
      </div>
      <div class="row clearfix">
        <input type="submit" name="submitBtn" id="submitBtn" class="submit" value="Update">
      </div>
    </form>
  </div>
</div>

